public class TestViewController {

        public Account account{get;set;}
        public list<ContactWrapper> ContactWrapperList{get;set;}
        public  List<CasesWrapper>  casewrapperList{get;set;}
        public List<Contact> contactList{get;set;}
        public List<Case> caseList{get;set;}      
        public set<Id> conId{get;set;}        
        public string AccId{get;set;}
        
        
           
        public TestViewController()
        
        {
            caseList=new List<Case>();
            ContactWrapperList=new list<ContactWrapper>();                                          
            conId=new set<Id>();
            
            
            AccId= ApexPages.currentPage().getParameters().get('id');
            account = [SELECT Id, Name from Account WHERE Id =:AccId]; 
            contactList=[select id,Name,AccountId from Contact where Account.id=:AccId];
            
            for(Contact con:contactList){
                        conId.add(con.id); 
                                                    
                  }        
            
            
            caseList=[select id,CaseNumber,ContactId from Case where Contact.id=:conId];
            
                    
                                 

            for(Contact conlist:contactList)
            
                {
                    
                    ContactWrapper wrapper=new ContactWrapper();               
                    wrapper.contact=conlist;
                    
                    
               
                       casewrapperList=new List<CasesWrapper>();
               
       
                    for(Case c:caseList)
                        { 

                               CasesWrapper casewrapper=new CasesWrapper();                
                                                 
                               if(conlist.Id==c.ContactID){
                               
                                     casewrapper.cases=c;                    
                                     casewrapperList.add(casewrapper);  
                                                                   
                                                                
                                 }
                                    
                            
                       }
                      wrapper.caseswrapperList=casewrapperList;
                      ContactWrapperList.add(wrapper);
            
            }
        
              
        }

}